<template>
  <div id="App">
    <div id="nav">
      <router-link to="/one">One</router-link>
      <router-link :to="{
        name:'Two'
      }">Two</router-link>
      <router-link to="/three">Three</router-link>
      <a @click="nav">Four</a>
    </div>
    <div id="content">
      <router-view />
    </div>
  </div>
</template>

<script setup lang='ts' name='App'>
import { useRoute,useRouter } from 'vue-router';
const router = useRouter();

//编程式路由导航
function nav() {
  router.push({
    name: 'Four'
  });
}

</script>

<style scoped>
#App {
  margin: 100px auto;
  width: 1000px;
  height: 600px;
  background-color: #ccc;
}
#nav{
  display: flex;
  justify-content: space-around;
}
a {
  text-decoration: none;
  font-size: 50px;
  text-align: center;
  line-height: 150px;
  display: inline-block;
  width: 250px;
  height: 150px;
  background-color: pink;
  border: 1px solid black;
}
</style>